/*************************************************************************
	> File Name: notify_msg.c
	> Author: xxx
	> Mail: xxx 
	> Created Time: 2022年05月30日 星期一 21时31分41秒
 ************************************************************************/

#include "notify_msg.h"
#include <string.h>
#include<log/log.h>

extern bear_notify_t gNotify;

void template_notify(float temp)
{
    bear_msg_t data_msg;
    data_msg.type = BEAR_TEMP;
    data_msg.cpu_temp = temp;
    gNotify(&data_msg);
}

void deflection_angle_notify(float pitch, float roll, float yaw){
    bear_msg_t data_msg;
    data_msg.type = BEAR_ANGLE_VALUE;
    data_msg.pitch = pitch;
    data_msg.roll = roll;
    data_msg.yaw = yaw;
    gNotify(&data_msg);
}

void original_data_notify(short *acceles, short *gyros){
    bear_msg_t data_msg;
    data_msg.type = BEAR_ACCELEANDGYRO;
    ALOGD("dylan ax:%d,ay:%d,az:%d, gx:%d, gy:%d, gz:%d",acceles[0],acceles[1], acceles[2], gyros[0], gyros[1], gyros[2]);
    //memcpy(data_msg.acceles, acceles, sizeof(data_msg.acceles));
    //memcpy(data_msg.gyros, gyros, sizeof(float)*3);
    for(int i=0;i<3;i++){
        data_msg.acceles[i]=acceles[i];
        data_msg.gyros[i]=gyros[i];
    }
    ALOGD("dylan gx:%f, gy:%f, gz:%f",data_msg.gyros[0], data_msg.gyros[1],data_msg.gyros[2]);
    ALOGD("dylan ax:%f, ay:%f, az:%f",data_msg.acceles[0], data_msg.acceles[1],data_msg.acceles[2]);
    gNotify(&data_msg);

}
